import java.awt.*;
import javax.swing.*;
import java.net.*;
import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.text.html.parser.*;

public class rssRead {
	private static String home;
	private static URL base;
    private static URL page;
    
    public rssRead(String s)
    {
        try {
            this.base =  new URL(s);
			this.home = s;
        } catch (MalformedURLException cce) {
            err("Base chosen is not a valid URL");
        }
    }
    
    private void crawlPage(URL u)
    {
        Reader r;
        page =u;
        base = u;
        
        try {
            Object content = u.getContent();
            r = new InputStreamReader((InputStream)content);
            System.out.println("Success");

            HTMLEditorKit.Parser parser;
            parser = new ParserDelegator();
            //LinkParser lp = new LinkParser();
            //parser.parse(r, lp, true);
        }
        catch (Exception e) {
            System.err.println("Error: " + e);
        }
    }
    
	public static void main(String[] args) {
		rssRead reader = new rssRead("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/england/merseyside/rss.xml");
		reader.crawlPage(base);
		}
    
    //*** Error algorithm
    private static void err(String s)
    {
        //Error printing
        System.err.println(s);
        System.exit(1);        
    }
}
